function z = Depth(P, lat)
  % function for calculating Depth ala SBE Data Procesing
  %
  % Author: David Goldsmith, Wash. State Dept. of Ecology, dgol461@ecy.wa.gov
  % Release date: N/A
  
    x = sin(lat / 57.29578);
    x = x * x;
    gr = 9.780318 * (1.0 + (5.2788e-3 + 2.36e-5 * x) * x) + 1.092e-6 * P;
    z = (((-1.82e-15 * P + 2.279e-10) .* P - 2.2512e-5) .* P + 9.72659) .* P;
    if (gr), z = z ./ gr; end
end